<?php

use App\Http\Controllers\Admin\AboutController;
use App\Http\Controllers\Admin\NoticeController;
use App\Http\Controllers\Admin\PrintExcelController;
use App\Http\Controllers\Admin\PrintReceiptsController;
use App\Http\Controllers\Admin\StoreController;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

//后台

Route::middleware(['admin.login'])->group(function(){



    //退出登錄
    Route::post('loginOut',[\App\Http\Controllers\Admin\AdminController::class,'loginOut']);
    //添加管理員
    Route::post('register',[\App\Http\Controllers\Admin\AdminController::class,'register']);

    //修改密码
    Route::post('updatePassword',[\App\Http\Controllers\Admin\AdminController::class,'updatePassword']);
    //权限菜单
    Route::get('admin/getinfo',[\App\Http\Controllers\Admin\AdminController::class,'getinfo']);

    //用戶管理
    Route::put('member/status/{id}',[\App\Http\Controllers\Admin\MemberController::class,'updateStatus']);
    Route::apiResource('member',\App\Http\Controllers\Admin\MemberController::class);
    //banner管理
    Route::put('banner/status/{id}',[\App\Http\Controllers\Admin\BannerController::class,'updateStatus']);
    Route::apiResource('banner',\App\Http\Controllers\Admin\BannerController::class);
//分類管理
    Route::apiResource('category',\App\Http\Controllers\Admin\CategoryController::class);
//優惠券
    Route::apiResource('coupon',\App\Http\Controllers\Admin\CouponController::class);
//產品管理
    Route::apiResource('product',\App\Http\Controllers\Admin\ProductController::class);
//評論管理
    Route::apiResource('comment',\App\Http\Controllers\Admin\CommentsController::class);
    Route::put('comment/status/{id}',[\App\Http\Controllers\Admin\CommentsController::class,'updateStatus']);
//损耗记录
    Route::apiResource('spoilage',\App\Http\Controllers\Admin\SpoilageController::class);
//采购记录
    Route::apiResource('purchase',\App\Http\Controllers\Admin\PurchaseController::class);
});


Route::apiResource('notice',NoticeController::class);

//登陆
Route::post('login',[\App\Http\Controllers\Admin\AdminController::class,'login']);

//图片上传
Route::apiResource('upload',\App\Http\Controllers\Admin\ImageController::class);

//图片分类
Route::apiResource('image',\App\Http\Controllers\Admin\ImageCateController::class);
//管理员列表
Route::get('getadmin',[\App\Http\Controllers\Admin\AdminController::class,'getAdmin']);
//删除管理员
Route::delete('deleteadmin/{id}',[\App\Http\Controllers\Admin\AdminController::class,'destroy']);
//角色管理
Route::apiResource('role',\App\Http\Controllers\Admin\RoleController::class);
//菜单
//Route::get('menu',[\App\Http\Controllers\Admin\AdminController::class,'menus']);
//菜单
Route::apiResource('menu',\App\Http\Controllers\Admin\RuleController::class);
//會員等級
Route::apiResource('integral',\App\Http\Controllers\Admin\IntegralController::class);
//预约订单
Route::apiResource('reservation',\App\Http\Controllers\Admin\ReservationController::class);
//订单
Route::apiResource('order',\App\Http\Controllers\Admin\OrderController::class);
//打印小票
Route::get('print',[PrintReceiptsController::class,'index']);
//导出訂單
Route::any('export',[PrintExcelController::class,'export']);
//導出商品數據
Route::any('exportproduct',[PrintExcelController::class,'exportProduct']);

//首页动态数据
Route::get('dynamic',[\App\Http\Controllers\Admin\AdminController::class,'dynamic']);
//关于我们
Route::apiResource('about',AboutController::class);
//客服
Route::apiResource('service',\App\Http\Controllers\Admin\ServiceController::class);
//疑问解答
Route::apiResource('query',\App\Http\Controllers\Admin\QueryController::class);
//数据分析
Route::get('analyse',[\App\Http\Controllers\Admin\ProductController::class,'analyse']);
//系統配置
Route::apiResource('config',\App\Http\Controllers\Admin\SystemConfigController::class);
//管理員日誌
Route::apiResource('log',\App\Http\Controllers\Admin\AdminLogController::class);
//店铺设置
Route::apiResource('store',StoreController::class);